package bid.yanhj.cniao5shop.webview;

import android.util.Log;
import android.webkit.JavascriptInterface;

public class PiccJsInterface {

    private static final String TAG = "yanhj";
    private JsBridge jsBridge;

    public PiccJsInterface(JsBridge jsBridge) {
        this.jsBridge = jsBridge;
    }

    // 添加注解 webview识别这个方法
    // 这个方法不在主线程执行
    @JavascriptInterface
    public void setValue(String value) {
        Log.d(TAG, "setValue: " + value);
        // 抛到主线程执行
        jsBridge.setTextViewValue(value);
    }
}
